package day013.homework.p6;

import java.util.ArrayList;
import java.util.Collection;

public class Test {
    public static void main(String[] args) {
        Collection<Double> coll = new ArrayList<>();
        double[] arr = {88.5, 39.2, 77.1, 56.8, 89, 99, 59.5};
        for (int i = 0; i < arr.length; i++) {
            coll.add(Double.parseDouble(arr[i] + ""));
        }

        for (Double d : coll) {
            System.out.print(d + " ");
        }
        System.out.println();

        for (Double d : coll) {
            if (d < 60) {
                System.out.print(d + " ");
            }
        }
        System.out.println();

        int count = 0;
        double avg = 0;
        for (Double d : coll) {
            avg += d;
            if (d < 60) {
                count++;
            }
        }
        System.out.println("不及格总数为：" + count + ",平均分为：" + avg / coll.size());

        double max = 0;
        for (Double d : coll) {
            if (d > max) {
                max = d;
            }
        }
        System.out.println("最高分为：" + max);
    }
}
